﻿Public Class vector

    Private _x As Double
    Private _y As Double
    Private _z As Double

    Public Sub New()

        Me.New(0, 0, 0)

    End Sub

    Public Sub New(ByVal x As Double, ByVal y As Double, ByVal z As Double)

        Me.x = x
        Me.y = y
        Me.z = z

    End Sub

    Public Sub New(ByVal p As vector)

        Me.New(p.x, p.y, p.z)

    End Sub

    Public Property x() As Double
        Get
            Return _x
        End Get
        Set(ByVal value As Double)
            _x = value
        End Set
    End Property

    Public Property y() As Double
        Get
            Return _y
        End Get
        Set(ByVal value As Double)
            _y = value
        End Set
    End Property

    Public Property z() As Double
        Get
            Return _z
        End Get
        Set(ByVal value As Double)
            _z = value
        End Set
    End Property

    Public Shared Operator -(ByVal V1 As vector, ByVal V2 As vector)

        Return New vector(V2.x - V1.x, V2.y - V1.y, V2.z - V1.z)

    End Operator

    Public Shared Operator +(ByVal V1 As vector, ByVal V2 As vector)

        Return New vector(V2.x + V1.x, V2.y + V1.y, V2.z + V1.z)

    End Operator

    Public Function tetha() As Double

        Return otherMath.RadToDeg(Math.Atan2(y, x))

    End Function

    Public Function len() As Double

        Return Math.Sqrt(y ^ 2 + x ^ 2)

    End Function

End Class
